home *** CD-ROM | disk | FTP | other *** search
/ .net 2002 March / DotNetMagazine-Issue107-Coverdisc-NET107-02-03-PCMac.bin / pc / PC Software / free_browsing / DavesQckSearchDbar3-14 / dqsd.exe / searches / freetrans.xml < prev    next >
Text File  |  2002-08-30  |  5KB  |  126 lines

  1. <search function="freetrans">
  2.   <name>FreeTranslation.com Language Translation</name>
  3.   <description>
  4.     Translate text or webpages from one language to another.<br/>
  5.       <a class="helpboxDescLabels">Switches:</a><br />
  6.       <table class="helpboxDescTable">
  7.           <tr><td>/from:en</td><td>/to:fr</td><td> - </td><td>English to French</td></tr>
  8.           <tr><td>/from:en</td><td>/to:de</td><td> - </td><td>English to German</td></tr>
  9.           <tr><td>/from:en</td><td>/to:it</td><td> - </td><td>English to Italian</td></tr>
  10.           <tr><td>/from:en</td><td>/to:pt</td><td> - </td><td>English to Portuguese</td></tr>
  11.           <tr><td>/from:en</td><td>/to:es</td><td> - </td><td>English to Spanish</td></tr>
  12.           <tr><td>/from:en</td><td>/to:no</td><td> - </td><td>English to Norwegian</td></tr>
  13.           <tr><td>/from:fr</td><td>/to:en</td><td> - </td><td>French to English</td></tr>
  14.           <tr><td>/from:de</td><td>/to:en</td><td> - </td><td>German to English</td></tr>
  15.           <tr><td>/from:it</td><td>/to:en</td><td> - </td><td>Italian to English</td></tr>
  16.           <tr><td>/from:pt</td><td>/to:en</td><td> - </td><td>Portuguese to English</td></tr>
  17.           <tr><td>/from:es</td><td>/to:en</td><td> - </td><td>Spanish to English</td></tr>
  18.       </table>
  19.     <div class="helpboxDescLabels">Examples:</div>
  20.     <table class="helpboxDescTable">
  21.           <tr><td>freetrans /from:en /to:es hello how are you</td></tr>
  22.       <tr><td>freetrans /from:en /to:es http://www.whitehouse.gov</td></tr>
  23.       </table>
  24.   </description>
  25.   <category>Reference</category>
  26.   <link>http://www.freetranslation.com</link>
  27.   <contributor>Neel Doshi, Greg Mitchell</contributor>
  28.   
  29.   <form name="freetransfTEXT"
  30.         action="http://ets.freetranslation.com:5081/"
  31.         method="post">
  32.     <input type="hidden" name="Sequence" value="core"/>
  33.     <input type="hidden" name="Mode" value="html"/>
  34.     <input type="hidden" name="template" value="TextResults2.htm"/>
  35.     <input type="hidden" name="Language"/>
  36.     <input type="hidden" name="SrcText"/>
  37.   </form>
  38.   
  39.   <form name="freetransfURL"
  40.         action="http://fets3.freetranslation.com:5081/"
  41.         method="post">
  42.     <input type="hidden" name="Sequence" value="core"/>
  43.     <input type="hidden" name="Language"/>
  44.     <input type="hidden" name="Url"/>
  45.   </form>
  46.   
  47.   <script><![CDATA[
  48.     function freetrans(q)
  49.     {
  50.         if(nullArgs("freetrans", q))
  51.             return false;
  52.         else
  53.         {
  54.             var func_name = "freetrans";
  55.             var switch_list = new Array("from", "to");
  56.             var args = parseArgs(q, switch_list);
  57.     
  58.             // check if the required switches are set
  59.             for (var j = 0; j < switch_list.length; j++)
  60.             {
  61.                 if ( typeof args.switch_val[ switch_list[j] ] == "undefined" || args.switch_val[ switch_list[j] ] == "" )
  62.                 {
  63.                     alert(func_name + ":  /" + switch_list[j] + " switch must be entered.  Type '" + func_name + " ?' to see instructions");
  64.                     return false;
  65.                 }
  66.             }
  67.     
  68.             // Convert the switches to freetrans text
  69.             for (j = 0; j < switch_list.length; j++)
  70.             {
  71.                 // Unfortunately, since we are attempting to match the syntax of this search with the babel search, if
  72.                 // freetranslations.com adds new languages, the search will need to be modified in this switch statement.
  73.                 switch ( args.switch_val[switch_list[j]]) {
  74.                     case "en":
  75.                         args.switch_val[switch_list[j]] = "English";
  76.                         break;
  77.                     case "fr":
  78.                         args.switch_val[switch_list[j]] = "French";
  79.                         break;
  80.                     case "de":
  81.                         args.switch_val[switch_list[j]] = "German";
  82.                         break;
  83.                     case "it":
  84.                         args.switch_val[switch_list[j]] = "Italian";
  85.                         break;
  86.                     case "pt":
  87.                         args.switch_val[switch_list[j]] = "Portuguese";
  88.                         break;
  89.                     case "es":
  90.                         args.switch_val[switch_list[j]] = "Spanish";
  91.                         break;
  92.                     case "no":
  93.                         args.switch_val[switch_list[j]] = "Norwegian";
  94.                         break;
  95.                     default:
  96.                         alert(func_name + ":  /" + switch_list[j] + " switch is not valid.  Type '" + func_name + " ?' to see instructions");
  97.                         return false;
  98.                 }
  99.             }
  100.     
  101.             // Determine if the string is a url or not
  102.             var strURL = isURL(args.q);
  103.             if (strURL)
  104.             {
  105.                 freetransfURL.Url.value = strURL;
  106.                 freetransfURL.Language.value =  args.switch_val["from"] + "/" +  args.switch_val["to"];
  107.                 submitForm(freetransfURL);
  108.             }
  109.             else
  110.             {
  111.                 freetransfTEXT.SrcText.value = args.q;
  112.                 freetransfTEXT.Language.value =  args.switch_val["from"] + "/" +  args.switch_val["to"];
  113.                 submitForm(freetransfTEXT);
  114.             }
  115.             return true;
  116.         }
  117.     }
  118.   ]]></script>
  119.  
  120.   <copyright>
  121.     Copyright (c) 2002 David Bau
  122.     Distributed under the terms of the
  123.     GNU Public License, Version 2 (http://www.gnu.org/copyleft/gpl.txt)
  124.   </copyright>
  125. </search>
  126.